// 
// Demonstrates use of the i2cdisplay slave
// by Raul Aguaviva
//

#include <Wire.h>
#include "konami.h"
//#include "knightlore.h"
#include "KS108.h"

#include "sinlut.h"
#include "KS108.h"


void setup()
{
  Wire.begin(); // join i2c bus (address optional for master)
  Serial.begin(9600);
  //Serial.println("ok");

  KS108_Init();
  KS108_Cls();

  KS0108_PrintStr3x6( "RAUL AGUAVIVA SOFTWARE\r");
  KS0108_PrintStr3x6( "I2CDISPLAY MODULE\r");
  KS0108_PrintStr3x6( "OK\r");

  //InitScan();
}

byte xx=1;
byte yy=1;
byte x=16,y=0;

void PingPong()
{
  x=x+xx;
  y=y+yy;
  if ( x==20 )
    xx=1;
  if ( x==63 )
    xx=-1;
  if ( y==0 )
    yy=1;
  if ( y==127 )
    yy=-1;

  delay(10);

  KS108_SetPixel(x, y, SET);
}



void SerialToLCD()
{
  if ( Serial.available() )
  {
    char c = Serial.read();
    if ( c == '`' )
    {
      KS108_Locate( 0, 0 );
    }
    else if ( c == 0 )
    {
      KS108_GetPicFromSerial();
    }
    else
    {
      KS0108_PrintChar3x6(c);
    }
    //Serial.print( c );
  }
  
  InitRotoZoom();
}

void loop()
{
  //DrawLinearScan();
  //DrawLinearScanSide();
  RotoZoom();
    
}






